package com.xzy.mapper;

import com.xzy.entity.Content;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PutMapping;

import java.util.List;

@Mapper
@Component(value="ContentMapper")
public interface ContentMapper {
    @Insert("insert into content(serialNumber,workContent,workProblem,workMeasure,solveProblem,reportId) values (#{serialNumber},#{workContent},#{workProblem},#{workMeasure},#{solveProblem},#{reportId})")
    void addContent(Content content);
    @Select("select * from content where reportId=#{reportId}")
    List<Content> getAllContent(int reportId);
    @Select("select * from content where reportId=#{reportId} and serialNumber=#{serialNumber}")
    Content getContent(int reportId,int serialNumber);
    @Delete("delete from content where reportId=#{reportId}")
    void deleteContents(int reportId);
    @Delete("delete from content where contentId=#{contentId}")
    void deleteContent(int contentId);
    @Update("update content set serialNumber=#{serialNumber},workContent=#{workContent},workProblem=#{workProblem},workMeasure=#{workMeasure},solveProblem=#{solveProblem} where contentId=#{contentId}")
    void updateContent(Content content);


}
